<template>
	<BaseContainer>
    <!-- <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
        <el-tab-pane v-for="(item, index) in tabList" :key="index" :label="item.label" :name="item.value">
        </el-tab-pane>
      </el-tabs> -->
      <TabChange v-model="activeName" :list="tabList" filter-key="label" filter-value="value" @tab-click="handleClick"></TabChange>
		<aplid-base-crud :key="key" ref="crud" class="w-100" v-bind="baseConfig" :paramsObj="paramsObj"> </aplid-base-crud>
	</BaseContainer>
</template>

<script setup lang="ts">
import { baseConfig } from './config'
import apiMod from '@/apiMod/index'
import TabChange from '@/views/aplid/TabChange/index.vue'
const rowData: any = inject('nowRowData')


let key = ref(1)
let tabList: any = ref([
  {label:'全部',value:undefined}
])
let activeName = ref(undefined)
let paramsObj = ref({
  staffIdCard: rowData.value.idCard,
  businessType: activeName.value
})
const handleClick = (e) => {
  if (e.value == 0) {
    paramsObj.value['businessType'] = undefined
  }else{
    paramsObj.value['businessType'] = e.value
  }
 
  key.value = Math.random()
}
// 获取业务类型字典，然后渲染tab
const getInitData = () => {
  apiMod.getDictItemList(['BUSINESS_TYPE']).then(res => {
    tabList.value = [...tabList.value, ...res.data['BUSINESS_TYPE']] 
  })
}
getInitData()
</script>

<style scoped></style>
